import axios, { ResponseData } from 'yuxin-base/src/utils/axios'

export function getPropertyList(data: object): Promise<ResponseData> {
	return axios.request({
		url: '/saas-rental-property/property/property/list',
		data,
		method: 'POST'
	})
}


export function getPropertyListBase(params: object): Promise<ResponseData> {
	return axios.request({
		url: '/saas-rental-property/property/property/list/base',
		params,
		method: 'GET'
	})
}

export function addProperty(data: object): Promise<ResponseData> {
	return axios.request({
		url: '/saas-rental-property/property/property',
		data,
		method: 'POST'
	})
}

export const getDeptTrees = (): Promise<ResponseData> => {
	return axios.request({
		url: '/saas-rental-uaa/uaa/department/list',
		method: 'GET'
	})
}

export const getProjectList = (params: Object): Promise<ResponseData> => {
	return axios.request({
		url: '/saas-rental-property/property/project/list',
		params,
		method: 'GET'
	})
}

export const getProjectOptions = (params: any): Promise<ResponseData> => {
	return axios.request({
		url: '/saas-rental-property/property/company/project/',
		params,
		method: 'GET'
	})
}

export const getPropertyUsage = (): Promise<ResponseData> => {
	return axios.request({
		url: '/saas-rental-property/property/property/usage',
		method: 'GET'
	})
}

export const getProjectBuilding = (id): Promise<ResponseData> => {
	return axios.request({
		url: `/saas-rental-property/property/project/building/tree/${id}?needFloorIds=true`,
		method: 'GET'
	})
}
export const gethouseType = (): Promise<ResponseData> => {
	return axios.request({
		url: '/saas-rental-property/property/property/houseType',
		method: 'GET'
	})
}
export const getloadPriceUnit = (): Promise<ResponseData> => {
	return axios.request({
		url: '/addon-fee/feeDetailEnum/loadPriceUnit',
		method: 'GET'
	})
}
export const getCompanyProject = (params: Object): Promise<ResponseData> => {
	return axios.request({
		url: '/saas-rental-property/property/company/project',
		params,
		method: 'GET'
	})
}
export const getCompanyProjects = (id): Promise<ResponseData> => {
	return axios.request({
		url: `/saas-rental-property/property/company/project/${id}?needPermission=false`,
		method: 'GET'
	})
}
export const getAreaInfo = (data: Object): Promise<ResponseData> => {
	return axios.request({
		url: '/saas-rental-property/property/state/count',
		data,
		method: 'POST'
	})
}
export const getDetailInfo = (id): Promise<ResponseData> => {
	return axios.request({
		url: `/saas-rental-property/property/property/${id}`,
		method: 'GET'
	})
}
//根据propertyIds查询资源关联的费项信息
export const getCostPrjectInfo = (id): Promise<ResponseData> => {
	return axios.request({
		url: `/saas-rental-property/property/property/fee/${id}`,
		method: 'GET'
	})
}
//删除资源列表数据
export const delResourcetable = (ids): Promise<ResponseData> => {
	return axios.request({
		url: `/saas-rental-property/property/del/${ids}`,
		method: 'DELETE'
	})
}
//费项关联 第二部 查询费项类别 {projectIds}/{companyIds}
export const getfeeType = (projectIds,companyIds): Promise<ResponseData> => {
	return axios.request({
		url: `/addon-fee/fee/info/${projectIds}/${companyIds}`,
		method: 'get'
	})
}
//费项关联 第三部根据费项id 查询费项信息
export const getfeeINfo = (feeIds): Promise<ResponseData> => {
	return axios.request({
		url: `/addon-fee/fee/info/${feeIds}`,
		method: 'get'
	})
}
//费项关联 第三步 提交信息.新增费项与资源的关系
export const submitFeeForm = (data): Promise<ResponseData> => {
	return axios.request({
		url: `/addon-fee/feeProperty/feePropertys`,
		method: 'post',
		data:data
	})
}
//查询详情里费项列表
export const getfeeList = (propertyId): Promise<ResponseData> => {
	return axios.request({
		url: `/addon-fee/feeProperty/${propertyId}`,
		method: 'get'
	})
}
//delFeeRelevance
export const delFeeRelevance = (propertyIds,feeIds): Promise<ResponseData> => {
	return axios.request({
		url: `/addon-fee/feeProperty/${propertyIds}/${feeIds}`,
		method: 'DELETE'
	})
}
//获取详情关联设备信息
export const getDetailsGlsb = (propertyIds): Promise<ResponseData> => {
	return axios.request({
		url: `saas-rental-device/device/device/list_property_device_group?propertyIdList=${propertyIds}`,
		method: 'get'
	})
}

//获取详情关联设备信息
export const getShareProperty = (mainPropertyId): Promise<ResponseData> => {
	return axios.request({
		url: `/saas-rental-property/property/view/shareProperty/${mainPropertyId}`,
		method: 'get'
	})
}
